import random
def rd():
    rdn = random.sample(range(1, 33), 8)
    return rdn
while True:
    str = input("请输入8位数字，并按逗号分隔")
    result = str.split(',')
    myTicket = list(map(int,result))
    luckTicket = rd()
    first,second,third,fourth,sorry = 0,0,0,0,0
    if len(myTicket) != 8:
        print("输入错误，需要8位")
        continue
    else:
        if len(list(set(luckTicket).intersection(set(myTicket))))==5:
            fourth = fourth + 1
        elif len(list(set(luckTicket).intersection(set(myTicket))))==6:
            third = third + 1
        elif len(list(set(luckTicket).intersection(set(myTicket))))==7:
            second = second + 1
        elif len(list(set(luckTicket).intersection(set(myTicket))))==8:
            first = first + 1
        else:
            sorry = sorry+1
        break
print(luckTicket)
print("一等奖:{}次".format(first))
print("二等奖:{}次".format(second))
print("三等奖:{}次".format(third))
print("四等奖:{}次".format(fourth))
print("未中奖:{}次".format(sorry))

# first, second, third, fourth, sorry = 0, 0, 0, 0, 0
# for i in range(100000):
#     luckTicket1 = rd()
#     myTicket1 = rd()
#
#     if len(list(set(luckTicket1).intersection(set(myTicket1)))) == 5:
#         fourth = fourth + 1
#     elif len(list(set(luckTicket1).intersection(set(myTicket1)))) == 6:
#         third = third + 1
#     elif len(list(set(luckTicket1).intersection(set(myTicket1)))) == 7:
#         second = second + 1
#     elif len(list(set(luckTicket1).intersection(set(myTicket1)))) == 8:
#         first = first + 1
#     else:
#         sorry = sorry + 1
# print("一等奖:{}次".format(first))
# print("二等奖:{}次".format(second))
# print("三等奖:{}次".format(third))
# print("四等奖:{}次".format(fourth))
# print("未中奖:{}次".format(sorry))